//
//  PICViewController.m
//  商城
//
//  Created by runone02 on 2018/11/6.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "PICViewController.h"
#import "NHGraphCoder.h"

@interface PICViewController ()
/** */
@property (nonatomic,strong) NHGraphCoder *coder;
/** */
@property (nonatomic,strong) UIImage *imgView;
@end

@implementation PICViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor cyanColor];
    CGSize size = self.view.bounds.size;
    
    self.imgView = [UIImage imageNamed:@"test_2.jpg"];
    self.coder = [NHGraphCoder codeWithImage:self.imgView];
    self.coder.center = CGPointMake(size.width*0.5, size.height*0.5);
    [self.coder handleGraphicCoderVerifyEvent:^(NHGraphCoder * _Nonnull cd, BOOL success) {
        
        if (success == 1) {

        }
        
    }];
    [self.view addSubview:self.coder];

    //    NSString *url = @"http://pic.pimg.tw/loloto/1357207442-1350656755_l.jpg?v=1357207447";
    //    NHGraphCoder *coder = [NHGraphCoder codeWithURL:url];
    //    coder.center = CGPointMake(size.width*0.5, size.height*0.5);
    //    [coder handleGraphicCoderVerifyEvent:^(NHGraphCoder * _Nonnull cd, BOOL success) {
    //        NSLog(@"验证结果:%d",success);
    //    }];
    //    [self.view addSubview:coder];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

     [self.coder resetStateForDetect];
}


@end
